package com.woniuxy.service.impl;

import com.woniuxy.entity.TopicMail;
import com.woniuxy.service.TopicService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 马宇航
 * @Description: TODO
 * @DateTime: 22/10/21/0021 15:19
 * @Component: 成都蜗牛学苑
 **/
@Service
public class TopicServiceImpl implements TopicService {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @Autowired
    RabbitTemplate.ReturnsCallback returnsCallback;
    @Override
    public void sendEmail(TopicMail mail) {
        for (int i = 0; i < 100; i++) {
            mail.setRoutingkey("only."+i);
            rabbitTemplate.convertAndSend("topicExchange",mail.getRoutingkey(),mail);
        }
    }
}
